package de.leuphana.internet.view;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import de.leuphana.internet.model.Warenkorb;
import de.leuphana.internet.model.WarenkorbElement;


/**
 * Servlet implementation class BuchladenServlet
 */
public class WarenkorbServlet extends BuchladenServlet {
	private static final long serialVersionUID = 1L;

	private Warenkorb warenkorb;

	@Override
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		super.doGet(request, response);

		HttpSession httpSession = request.getSession(true);

		warenkorb = (Warenkorb) httpSession.getAttribute("warenkorb");
		
		// TODO falls warenkorb null ist an Fehlerseite weiterleiten
	}

	protected void druckeKopf(String titel) {
		super.druckeKopf("warenkorb");
	}

	@Override
	protected void druckeInhalt() {

		out.println("<p>warenkorb</p>");

		for (WarenkorbElement warenkorbElement: warenkorb.getWarenkorbElemente()) {
			//TODO Ausgabe Warenkorb
			out.println("");
		}

	}

}
